/*
 *  Planet.h
 *  SpaceTrader
 *
 *  Created by Andrew on 10/16/12.
 *  Copyright 2012 The Hex Pistols. All rights reserved.
 *
 */

#pragma once
#include "GuiTools.h"
#include "SpaceTrader.h"
#include "Market.h"
#include "boost/archive/text_oarchive.hpp"
#include "boost/archive/text_iarchive.hpp"
#include <fstream>


class Planet {
	
private:
	friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    {
        //serialization
        ar & name;
        ar & x;
        ar & y;
        ar & techLevel;
        ar & resources;
        ar & worldEvent;
        ar & inventory;
    }
    
	std::string name;
	
	//location within its system
	int x;
	int y;
	
	SDL_Surface *icon;
	Market *market;

	tech_level_t techLevel;
	resources_t resources;
	world_event_t worldEvent;
	
	
	int inventory[GOODCOUNT];
	
public:
	Planet();
    
	Planet(std::string, int, int, SDL_Surface *icon, Market *market);
	
	Planet(std::string, int, int, tech_level_t, resources_t, world_event_t, SDL_Surface *icon, Market *market);
    
    Planet(const Planet &P);
	
	~Planet();
    
    Planet& operator=(const Planet &P);
	
	std::string getName();
	
	tech_level_t getTechLevel();
	
	resources_t	getResources();
	
	world_event_t getWorldEvent();
	
	char *techLevelToString();
	
	char *resourcesLevelToString();
	
	char *worldEventToString();

	int getX();
	int getY();
	
	int* getInventory();
	
	void show(SDL_Surface *screen);
	
};